package acmCoder;

import java.util.Scanner;

public class Salary2021 {

	public static int[] money = {100,50,20,10,5,2,1};
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int teacherPeople;
		int[] teacherSalary;
		while(scanner.hasNext()){
		   teacherPeople = scanner.nextInt();
		   if(teacherPeople == 0){
			   break;
		   }
		   teacherSalary = new int[teacherPeople];
		   for (int i = 0; i < teacherSalary.length; i++) {
			   teacherSalary[i] = scanner.nextInt();
		   }
		   getMoneyCount(teacherSalary);
		}
		scanner.close();
	}
//	钱有100元、50元、10元、5元、2元和1六种
	public static void getMoneyCount(int[] teacherSalary){
		int count = 0;
		System.out.println(teacherSalary.length);
		for (int i = 0; i < teacherSalary.length; i++) {
			for (int j = 0; j < money.length; j++) {
				if (teacherSalary[i] >= money[j]) {
					count += teacherSalary[i] / money[j];
					teacherSalary[i] = teacherSalary[i] % money[j];
					if (teacherSalary[i] == 0)
						break;
				}
			}
			System.out.println(i + "i Count" + count);
		}
		System.out.println(count);
	}
}
